﻿<MudDropContainer T="SimpleDropItem"
				  Items="_items" ItemsSelector="@((item,dropzone) => item.ZoneIdentifier == dropzone)"
				  Class="d-flex"
				  DisabledClass="my-custom-disabled-class-from-container" ItemDisabled="@( (item) => item.Name == "First Item" || item.Name == "Third Item")"
				  ItemDropped="ItemUpdated">
	<ChildContent>
		<MudDropZone T="SimpleDropItem" Identifier="Column 1" Class="first-drop-zone"
					 ItemDisabled="@( (item) => item.Name == "Fourth Item")" DisabledClass="my-zone-based-custom-disabled">
			<MudText Typo="Typo.h6" Class="mb-4">Drop Zone 1</MudText>
		</MudDropZone>
		<MudDropZone T="SimpleDropItem" Identifier="Column 2" Class="second-drop-zone">
			<MudText Typo="Typo.h6" Class="mb-4">Drop Zone 2</MudText>
		</MudDropZone>
	</ChildContent>
	<ItemRenderer>
		<MudText>@context.Name</MudText>
	</ItemRenderer>
</MudDropContainer>

@code {
    private readonly IEnumerable<SimpleDropItem> _items =
    [
        new("First Item", "Column 1"),
        new("Second Item", "Column 2"),
        new("Third Item", "Column 2"),
        new("Fourth Item", "Column 1")
    ];

	private static void ItemUpdated(MudItemDropInfo<SimpleDropItem> dropItem)
    {
        if (dropItem.Item is null)
        {
            return;
        }

        dropItem.Item.ZoneIdentifier = dropItem.DropzoneIdentifier;
    }

    public class SimpleDropItem(string name, string zoneIdentifier)
    {
        public string Name { get; set; } = name;

        public string ZoneIdentifier { get; set; } = zoneIdentifier;
    }
}
